home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / J-M / MacHelp.cpt / Apple Sac Information / background_2648.txt < prev    next >
Text File  |  1989-02-26  |  4KB  |  126 lines

  1. -- background: 2648 from stack: in
  2. -- bmap block id: 3292
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: Six Monthly
  6. ----- HyperTalk script -----
  7. on closeCard
  8.   hide bkgnd button "Bracket"
  9. end closeCard
  10.  
  11. on mouseUp
  12.   --give a date in the week that was clicked on, (a month field)
  13.   if the name of the target contains "name" or the name of the target contains "year" then exit mouseUp
  14.   put the short name of the target & "name" into label
  15.   put (item 2 of the clickLoc) - (item 2 of the rect of the target) into myDay
  16.   put (myDay DIV textHeight of the target) +1 into myDay
  17.   put word myDay of "1 8 15 22 29 36" into myDay
  18.   put field label && myDay & "," && field "year" into myDate
  19.   convert myDate to dateItems
  20.   if item 7 of myDate = 1 then add 1 to item 3 of myDate
  21.   --if using a Sunday, move into the next week
  22.   goWeekly myDate
  23. end mouseUp
  24.  
  25. on bracketWeek myDate
  26.   --assume we are on the right card
  27.   convert myDate to dateItems
  28.   put item 2 of myDate into it
  29.   if it > 6 then subtract 6 from it
  30.   put "cal" & it into myField
  31.   put ((item 3 of myDate) + 6 - (item 7 of myDate)) DIV 7 into it
  32.   put loc of field myfield into newLoc
  33.   put item 2 of rect of field myField into item 2 of newLoc
  34.   add (it * the textHeight of field myField) + 7 to item 2 of newLoc
  35.   show bkgnd button "bracket" at newLoc
  36. end bracketWeek
  37.  
  38. on extendHalfYearly
  39.   if the number of backgrounds > 1 then
  40.     go to last card of bkgnd "weekly"
  41.     get field "month"
  42.     put word 2 of it && "1," && word 1 of it into endDate
  43.   else put the seconds + (60*60*24*31) into endDate
  44.   convert endDate to seconds
  45.   go to last card of bkgnd "six monthly"
  46.   put field cal6Name && "1," && field "year" into nowDate
  47.   convert nowDate to seconds
  48.   add 60*60*24*32 to nowDate     --start of next 6 month period
  49.   repeat until nowDate >= endDate
  50.     doMenu "New Card"
  51.     fillHalfYear nowDate
  52.     add 60*60*24*183 to nowDate
  53.   end repeat
  54.   put the number of this card into it  --last sixMonth card
  55.   if (the number of backgrounds > 1) and (it > 5) then
  56.     go to first card of bkgnd "Six Monthly"
  57.     if the number of this card = 1 then
  58.       repeat for it-5   --only allow 5 cards at the front
  59.         doMenu "delete card"
  60.       end repeat
  61.     end if
  62.   end if
  63. end extendHalfYearly
  64.  
  65. on fillHalfYear startDate
  66.   convert startDate to dateItems
  67.   if item 2 of startDate is not in "1 7" then exit fillHalfYear
  68.   put item 1 of startDate into field Year
  69.   convert startDate to seconds
  70.   repeat with ff = 1 to 6
  71.     put startDate into it
  72.     convert it to long date
  73.     put word 1 of item 2 of it into field ("cal" & ff & "name")
  74.     put " 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 " & "18 19 20 21 22 23 24 25 26 27 28" into field ("cal" & ff)
  75.     convert it to dateItems
  76.     put 1 into item 3 of it
  77.     convert it to long date
  78.     convert it to dateItems
  79.     repeat (item 7 of it)-1
  80.       put "   " before field ("cal" & ff)
  81.     end repeat
  82.     repeat with dd = 29 to 31
  83.       put dd into item 3 of it
  84.       convert it to long date
  85.       convert it to dateItems
  86.       if item 3 of it = dd
  87.       then put space & dd after field ("cal" & ff)
  88.     else exit repeat
  89.   end repeat
  90.   put return after character 42 of field ("cal" & ff)
  91.   put return after character 21 of field ("cal" & ff)
  92.   add 60*60*24*31 to startDate
  93. end repeat
  94. end fillHalfYear
  95.  
  96. on newStack
  97.   put the seconds into myDate
  98.   convert myDate to dateitems
  99.   if item 2 of myDate > 6
  100.   then put 7 into item 2 of myDate
  101. else put 1 into item 2 of myDate
  102. fillHalfYear myDate
  103. end newStack
  104.  
  105.  
  106.  
  107. -- part 57 (button)
  108. -- low flags: 80
  109. -- high flags: 0002
  110. -- rect: left=281 top=246 right=259 bottom=409
  111. -- title width / last selected line: 0
  112. -- icon id / first selected line: 0 / 0
  113. -- text alignment: 1
  114. -- font id: 0
  115. -- text size: 12
  116. -- style flags: 0
  117. -- line height: 16
  118. -- part name: Bracket
  119. ----- HyperTalk script -----
  120. on mouseUp
  121.   --should be behind all fields, but just in case
  122.   hide bkgnd button "bracket"
  123.   click at the loc of bkgnd button "bracket"
  124. end mouseUp
  125.  
  126.